mvc invalidOperationException: Method InvokeAsync of view component should be declared to return Taskt

104

mvc invalidOperationException: Method 'InvokeAsync' of view component should be declared to return Task<t> </t> -

public class ExampleViewComponent : ViewComponent {
    public Task&lt;IViewComponentResult&gt; InvokeAsync() {
        ExampleModel model = new ExampleModel(2);

        // returns a finished task
        return Task.FromResult&lt;IViewComponentResult&gt;(View(model));
    }
}

Comments

Submit
0 Comments